#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> pii;

void solve() {
    int k;
    cin >> k;
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    if(abs(n - m) >= 2) {
        cout << "No\n";
        return;
    }
    int f = 0;
    for(int i = 0, j = 0; i < n && j < m; ){
        cout << i;
        if(s[i] == t[j]) {
            i++, j++;
        }else{
            if(n == m) i++, j++;
            else if(n > m) i++;
            else j++;
            f++;
        }
        if(f >= 2){
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main() {
    solve();
    return 0;
}